{% extends 'layout/base.html' %}
{% load static %}
{% block content %}
<div class="container-fluid">

    <div class="row">

        <div class="col-lg-12">
            <div class="card">
                <div class="card-header"><h4>公众号类型数量统计 - 1</h4></div>
                <div class="card-body">
                  <div id="bar" style="width: 100%; height: 469px;"></div>

                </div>
            </div>
        </div>
    </div>

</div>
{% endblock %}
{% block js %}
 <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"></script>
<script>
        var chart = echarts.init(document.getElementById('bar'), 'white', {renderer: 'canvas'});
        $(function () {
          fetchData(chart);
        });

        function fetchData() {
            $.ajax({
                type: "GET",
                url: "{% url 'data:bar' %}",
                dataType: 'json',
                success: function (result) {
                    chart.setOption(result.data);
                    console.log(result.data)
                }
            });
        }
</script>
{% endblock %}